package com.example.service.impl;

import ch.qos.logback.classic.spi.EventArgUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mapper.RegisterMapper;
import com.example.po.Checkapply;
import com.example.po.Register;
import com.example.service.CheckapplyService;
import com.example.mapper.CheckapplyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* @author 赵子涵
* @description 针对表【checkapply】的数据库操作Service实现
* @createDate 2025-07-06 00:10:17
*/
@Service
public class CheckapplyServiceImpl extends ServiceImpl<CheckapplyMapper, Checkapply>
    implements CheckapplyService{
    @Autowired
    private CheckapplyMapper checkapplyMapper;
    @Autowired
    private RegisterMapper registerMapper;
    @Override
    public Map<String, Object> getinfoByMedicalID(Integer medicalid) {
        //1.查询患者信息
        QueryWrapper<Register> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("CaseNumber",medicalid);
        Register register = registerMapper.selectOne(queryWrapper);
        //2.查询患者的收费项目信息
        List<Map<String, Object>> list=checkapplyMapper.getinfoByMedicalID(medicalid);
        //3.返回结果
        Map<String,Object> result = new HashMap<>();
        result.put("info",register);
        result.put("list",list);
        return result;
    }

    @Override
    public Map<String, Object>  getbydeptname(String deptname,int state,String realname) {
        List<Map<String, Object>> list=checkapplyMapper.getbydeptname(deptname, state, realname);
        Map<String,Object> result = new HashMap<>();
        result.put("list",list);
        return result;
    }
}




